package com.niubility.server.Impl;


import com.niubility.dao.FollowDao;
import com.niubility.entity.Follow;
import com.niubility.server.IFollowServer;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

@Service("followServer")
public class FollowServer implements IFollowServer {
    @Resource
    private FollowDao followDao;
    public List<Follow> LoadAll(){
        return followDao.LoadAll();
    }
    public Follow Select(Follow follow){
        return followDao.Select(follow);
    }
    public int Save(Follow follow){
        return followDao.Save(follow);
    }
    public int Delete(Follow follow){
        return followDao.Delete(follow);
    }
    public int Update(Follow follow){
        return followDao.Update(follow);
    }

    public int FollowCount( int foledId){return followDao.FollowCount(foledId);}

    public int[] FollowLabId(int folId){//王勇
        ArrayList<Follow> followList = (ArrayList<Follow>)followDao.LabId(folId);
        int[] foledId = new int[followList.size()];
        for(int i=0;i<foledId.length;i++ ){
            foledId[i] = followList.get(i).getFoledId();
        }
        return foledId;

    }
    public int FollowNumber(int foledId){//王勇
        return followDao.FollowCount(foledId);
    }
    public int FollowDepNumber(int folId){
        return followDao.FollowDepNum(folId);
    }

    public int[] FoledId(int folId){
        ArrayList<Follow> followList = (ArrayList<Follow>)followDao.SelectFollowByFolId(folId);
        int[] foledId = new int[followList.size()];
        for(int i=0;i<foledId.length;i++ ){
            foledId[i] = followList.get(i).getFoledId();
        }
        return foledId;
    }



}